package com.example.dell.zyfypt_226wzy.fragment;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;

import com.example.dell.zyfypt_226wzy.R;
import com.example.dell.zyfypt_226wzy.activity.LoginActivity;
import com.example.dell.zyfypt_226wzy.bean.SessionIDBean;


public class MyFragment extends Fragment {
    private View view = null;
    private Context context;
    private SessionIDBean sessionIDBean;
    private TextView realName;
    private Button btn_cancel;


    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        context=getActivity();
        //动态加载Fragment1的布局文件
        view = inflater.inflate(R.layout.fragment_my, container, false);
        realName = (TextView) view.findViewById(R.id.tv_reslName);
        btn_cancel=(Button)view.findViewById(R.id.btn_cancel);
        btn_cancel.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent=new Intent(context, LoginActivity.class);
                startActivity(intent);
            }
        });
        if (sessionIDBean.realName.equals("")) {
            realName.setText("您注册时未填写真实姓名");
        } else {
            realName.setText("真实姓名：" + sessionIDBean.realName);
        }
        return view;
    }
}
